package com.example.jobtask;

import com.example.jobtask.service.JobTaskService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.scheduling.annotation.EnableScheduling;

@SpringBootApplication
@EnableScheduling
public class JobTaskBackendApplication implements CommandLineRunner {

	@Autowired
	private JobTaskService jobTaskService;

	public static void main(String[] args) {
		SpringApplication.run(JobTaskBackendApplication.class, args);
	}

	@Override
	public void run(String... args) throws Exception {
		// 应用启动时初始化活跃任务
		jobTaskService.initializeActiveTasks();
	}
}
